//
//  Live_Cell.m
//  pz_live
//
//  Created by caiyc on 2018/9/17.
//  Copyright © 2018年 caiyc. All rights reserved.
//   直播大厅的cell样式

#import "Live_Cell.h"
#import "CProGressView.h"
@implementation Live_Cell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contents_View.layer.cornerRadius = 5;
    
    
    // Initialization code
}
-(void)setViewAutoLayout{
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
        
    }];
}
-(void)bindData:(NSDictionary *)dic{
    CProGressView *progress = [[CProGressView alloc]initWithFrame:CGRectMake(0, 0, self.progressView.frame.size.width-30, 7)];
    [self.progressView addSubview:progress];
    progress.progressValue = @"0.7";
    NSURL *brand_Url = [NSURL URLWithString:dic[@"logo"]];
    
    [self.brand sd_setImageWithURL:brand_Url placeholderImage:[UIImage imageNamed:@"logo"]];
    self.title.text = dic[@"prize_title"];
    NSURL *good_Url = [NSURL URLWithString:dic[@"thumb"]];
   [ self.image sd_setImageWithURL:good_Url placeholderImage:[UIImage imageNamed:@"logo"]];
   self.price.textColor = PRICE_COLOR;

    
    NSString *price_text = [NSString stringWithFormat:@"¥%@元",dic[@"price"]];
    NSDictionary *attrDict1 = @{NSFontAttributeName:[UIFont fontWithName: @"Helvetica-Bold" size: 18],
                                NSForegroundColorAttributeName:PRICE_COLOR };
     NSAttributedString *attrStr1 = [[NSAttributedString alloc] initWithString: [price_text substringWithRange: NSMakeRange(0, price_text.length)] attributes: attrDict1];
    
    NSString *price_text1 = @"抢购  ";
    NSDictionary *attrDict2 = @{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:PRICE_COLOR };
    NSAttributedString *attrStr3 = [[NSAttributedString alloc] initWithString: price_text1 attributes: attrDict2];
    
    NSString *old_price = [NSString stringWithFormat:@"  ¥%@",dic[@"prize_price"]];
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle],NSForegroundColorAttributeName:[UIColor grayColor]};
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:[old_price substringWithRange: NSMakeRange(2, old_price.length-2)] attributes:attribtDic];

    NSMutableAttributedString *attributedStr03 = [[NSMutableAttributedString alloc] initWithAttributedString: attrStr1];
    [attributedStr03 appendAttributedString:attrStr3];
    [attributedStr03 appendAttributedString:attribtStr];
    self.price.attributedText = attributedStr03;
    self.describe.text = dic[@"prize_desc"];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
